package com.myway.dto.insurance.domain;

import java.util.HashMap;

public enum InsuranceType {
	CANCEL("cancel"),
	
	DELAY("delay"),
	
	HDELAY("h_delay"),
	
	ACCIDENT("accident"),
	
	HACCIDENT("h_accident");
	
	
	private final String alias;
	private static HashMap<String, InsuranceType> map;

	static {
		map = new HashMap<String, InsuranceType>();
		for (InsuranceType type : InsuranceType.values()) {
			map.put(type.alias, type);
		}
	}

	InsuranceType(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	public static InsuranceType valueOfAlias(String alias) {
		InsuranceType type = map.get(alias);
		if (type == null) {
			throw new IllegalArgumentException("Unknown action alias [" + alias
					+ "]");
		}
		return type;
	}

	/**
	 * @return the alias
	 */
	public String getAlias() {
		return this.alias;
	}

}
